<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <title>传智健康</title>
    <meta content="传智健康" name="description">
    <meta content="传智健康" name="keywords">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link href="../plugins/elementui/index.css" rel="stylesheet">
    <link href="../plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">

    <style type="text/css">
        .el-main {
            position: absolute;
            top: 70px;
            bottom: 0px;
            left: 200px;
            right: 10px;
            padding: 0;
        }
    </style>
</head>
<body class="hold-transition skin-purple sidebar-mini">
<div id="app">
    <el-container>
        <el-header class="main-header" style="height:70px;">
            <nav :class='' class="navbar navbar-static-top">
                <!-- Logo -->
                <a class="logo" href="#" style="text-align:center">
                    <span class="logo-lg"><img src="../img/logo.png"></span>
                </a>
                <div class="right-menu">
                    <span class="help"><i aria-hidden="true" class="fa fa-exclamation-circle"></i>帮助</span>
                    <el-dropdown @command="handleCommand" class="avatar-container right-menu-item" trigger="click">
                        <div class="avatar-wrapper">
                            <img class="user-avatar" src="../img/user2-160x160.jpg">
                            {{username}}
                        </div>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item divided>
                                <span style="display:block;">修改密码</span>
                            </el-dropdown-item>
                            <el-dropdown-item command="/logout.do" divided>
                                <span style="display:block;">退出</span>
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </nav>
        </el-header>
        <el-container>
            <el-aside width="200px">
                <el-menu>
                    <el-submenu :index="menu.path" v-for="menu in menuList">
                        <template slot="title">
                            <i :class="menu.icon" class="fa"></i>
                            {{menu.title}}
                        </template>
                        <template v-for="child in menu.children">
                            <el-menu-item :index="child.path">
                                <a :href="child.linkUrl" target="right">{{child.title}}</a>
                            </el-menu-item>
                        </template>
                    </el-submenu>
                </el-menu>
            </el-aside>
            <el-container>
                <iframe class="el-main" frameborder="0" height="580px" name="right" src="ordersetting.html"
                        width="100%"></iframe>
            </el-container>
        </el-container>
    </el-container>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            username: '',    //当前登录用户的用户名
            menuList: []
        },
        methods: {
            handleCommand(command) {
                window.location.href = command;
            }
        },
        created() {
            //发送ajax请求,请求Controller获取当前的登录用户名,展示到页面中
            axios.get("/user/getUsername.do").then((res) => {
                if (res.data.flag) {
                    this.username = res.data.data;
                    axios.get("/user/findMenu.do?userName="+this.username).then((res)=>{
                        if (res.data.flag){
                            this.menuList=res.data.data;
                            // alert(this.menuList)
                        }
                    })
                }
            });
        }
    });
    $(function () {
        let wd = 200;
        $(".el-main").css('width', $('body').width() - wd + 'px');
    });
</script>
</html>
